﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Views/Shared/Default.Master" CodeBehind="Manage.aspx.cs" Inherits="AcademicPlanner.Presentation.Views.Schedules.Manage" %>

<%@ Import Namespace="AcademicPlanner.Framework.Helpers" %>
<%@ Import Namespace="AcademicPlanner.Presentation.Views.Shared" %>

<asp:Content ID="Content1" ContentPlaceHolderID="headplace" runat="server"></asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="pageheadingplace" runat="server">
	<%= Html.Encode(pageHeading) %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="contentplace" runat="server">
	<%= WidgetHelper.PageTipBlock(pageTip) %>
	<div class="schedules rows-wrapper">
		<div class="row">
			<div class="cell">
				<%= Html.Encode(Tr("Select Schedule:"))%>
			</div>
			<div class="cell">
				<%= Html.ActionLink(Html.Encode(Tr("New Schedule...")),
											"AcademicScheduleForm", "Controls", 
						new { pScenario = AcademicScheduleFormScenario.CREATE, pAcademicScheduleId = 0, pPlanId = Model.AcademicPlan.EntityId }, 
						new { onclick = "return gManageSchedulesPageCtrl.handleCreateSchedule(event, this)" }) %>
			</div>
		</div>
		<% foreach (var vSchedule in Model.AcademicPlan.Schedules.ToList())
			{ %>
				<div class="schedule row" cEditFormUrl="<%= Url.Action("AcademicScheduleForm", "Controls",
															new { pScenario = AcademicScheduleFormScenario.EDIT, 
																pAcademicScheduleId = vSchedule.EntityId, 
																pPlanId = Model.AcademicPlan.EntityId }) %>"
										  cDeleteUrl="<%= Url.Action("Delete", "Schedules",
															new { pId = vSchedule.EntityId }) %>"
										  cControlUrl="<%= Url.Action("AcademicScheduleControl", "Controls", 
															new { pAcademicScheduleId = vSchedule.EntityId }) %>">
					<div class="cell">
						<%= Html.NBS() %>
					</div>
					<div class="cell top-separator">
						<span class="link schedule-name" onclick="gManageSchedulesPageCtrl.onScheduleClick(event, this)">
							<%= Html.Encode(vSchedule.Name) %>
						</span>
						<span class="right">
							<span onclick="gManageSchedulesPageCtrl.onEditScheduleClick(event, this)" class="link">
								<%= Html.Encode(Tr("Edit")) %>
							</span>
							<%= Html.NBS() %>|<%= Html.NBS() %>
							<span onclick="gManageSchedulesPageCtrl.onDeleteScheduleClick(event, this)" class="link">
								<%= Html.Encode(Tr("Delete")) %>
							</span>
						</span>
					</div>
				</div>
			<% } %>
	</div>
	<div id="scheduleControlHolder" class="top-padded"></div>
	<%= Html.Break(2) %>
	<%= WidgetHelper.DialogBlock("saveScheduleDialog", Html.Encode(Tr("Enter schedule information")), "")%>
	<script type="text/javascript">
		gDomReadyQueue.push('gManageSchedulesPageCtrl.init();');
		gManageSchedulesPageCtrl.messageConfirmDelete = '<%= SecurityHelper.Escape(Tr("Are you sure you want to delete this schedule?")) %>';
		gManageSchedulesPageCtrl.buttonTexts.submit = '<%= SecurityHelper.Escape(Tr("Save")) %>';
		gManageSchedulesPageCtrl.buttonTexts.cancel = '<%= SecurityHelper.Escape(Tr("Cancel")) %>';
	</script>
</asp:Content>
